** Figure 7
clear all
set more off 
capture log close
 
* Main path to data
global path "~/Dropbox/Paraguay/1_data/7_replication_dataverse"
capture cd "$path"	

*figures= analysis figures
global figures "$path/figures"

* Load panel data
use "$path/data/repression_panel.dta", clear

* Create period dummies (using underscores instead of hyphens)
foreach period in 1954_1958 1959_1963 1964_1968 1969_1973 1974_1978 1979_1983 1984_1988 {
    gen period_`period' = 0
}

replace period_1954_1958 = 1 if year < 1959
replace period_1959_1963 = 1 if year >= 1959 & year < 1964
replace period_1964_1968 = 1 if year >= 1964 & year < 1969
replace period_1969_1973 = 1 if year >= 1969 & year < 1974
replace period_1974_1978 = 1 if year >= 1974 & year < 1979
replace period_1979_1983 = 1 if year >= 1979 & year < 1984
replace period_1984_1988 = 1 if year >= 1984 & year <= 1988

* Generate alt_base and set to 0 
gen alt_1954_1958 = 0

* Regression
reghdfe log_violations ///
     alt_1954_1958  period_1959_1963#c.lambda_z period_1964_1968#c.lambda_z ///
    period_1969_1973#c.lambda_z period_1974_1978#c.lambda_z period_1979_1983#c.lambda_z ///
    period_1984_1988#c.lambda_z lambda_z  ///
 ///
  if  year > 1954 & year <= 1988, absorb(year#depa) cluster(district) nocons

* Plot
coefplot, vertical omitted drop(lambda_z) ///
    yline(0, lcolor(red)) ///
    xlabel(1 "1954-1958" 2 "1959-1963" 3 "1964-1968" 4 "1969-1973" 5 "1974-1978" 6 "1979-1983" 7 "1984-1988", angle(45)) ///
    xtitle("Five-year Period", size(3.7) margin(small)) ///
    ytitle("Effect relative to 1954-1958", size(3.7) margin(small)) ///
    ciopts(recast(rcap) color(grey40)) ///
    msymbol(circle) ///
    mcolor(grey40) ///
    msize(2) ///
    yscale(range(-0.1 0.41)) ///
    ylabel(-0.1(0.1)0.41, angle(0) format(%9.2f)) ///
    xline(1, lpattern(dash) lcolor(grey40))
	


graph export "$figures/figure7.pdf", replace 
